package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始运行");
        try {
            String line = "s";
            System.out.println(line.length());
            System.out.println(line.charAt(0));
            System.out.println(Integer.parseInt(line));
            System.out.println("!!!!!!!!!!!!!!!!");
//        }catch(NullPointerException e){
//            System.out.println("空指针异常");
//        }catch(StringIndexOutOfBoundsException e){
//            System.out.println("捕获空指针异常");
        } catch (NullPointerException | StringIndexOutOfBoundsException e) {
            System.out.println("出现了空指针或下标越界异常");
        }catch (Exception e){
            System.out.println("就是出了个错");
        }

        System.out.println("执行完毕");
    }
}
